/**************************************************************************
 *                                                                        *
 *         Copyright (c) 2007 by Sunplus mMedia Inc.                      *
 *                                                                        *
 *  This software is copyrighted by and is the property of Sunplus        *
 *  mMedia Inc. All rights are reserved by Sunplus mMedia Inc.  This      *
 *  software may only be used in accordance with the corresponding        *
 *  license agreement. Any unauthorized use, duplication, distribution,   *
 *  or disclosure of this software is expressly forbidden.                *
 *                                                                        *
 *  This Copyright notice MUST not be removed or modified without prior   *
 *  written consent of Sunplus mMedia Inc.                                *
 *                                                                        *
 *  Sunplus mMedia Inc. reserves the right to modify this software        *
 *  without notice.                                                       *
 *                                                                        *
 *  Sunplus mMedia Inc.                                                   *
 *  19-1, Innovation First Road, Science-Based Industrial Park,           *
 *  Hsin-Chu, Taiwan, R.O.C.                                              *
 *                                                                        *
 **************************************************************************/

#ifndef __STDDESC_H__
#define __STDDESC_H__
//------------------------------------------------------------------------------
//Constant
//------------------------------------------------------------------------------
//version4.0 richie@ps0503
#define K_INTERFACE4	0

//patch4.5@richie@audio interface
#define K_AUDIOINTER	0

//Descriptor Content
//---- Device Descriptor ----
#define K_DEVICE_DESCRIPTOR_SIZE        0x0012
xdata    UINT8   K_DeviceDescriptor[] =
{
        //-------------------------------------------------------------------
        //TotalLength = 0x0012 byte
        //-------------------------------------------------------------------

        //Device (0x12 byte)
        0x12,                   //bLength: 0x12 byte
        0x01,                   //bDescriptorType: DEVICE
        0x00, 0x01,             //bcdUSB: version 1.00
        0x00,                   //bDeviceClass: independent interfaces
        0x00,                   //bDeviceSubClass: 0
        0x00,                   //bDeviceProtocol: class specific protocols NOT used on device basis
        0x40,                   //bMaxPacketSize0: maximum packet size for endpoint zero
        0xfc, 0x04,             //idVendor: vendor ID
        0x28, 0x15,             //idProduct: product ID
        0x00, 0x01,             //bcdDevice: device release number in BCD
        0x01,                   //iManufacturer: index of string
        0x02,                   //iProduct: index of string 
        0x00,                   //iSerialNumber: index of string  //patch4.3@cytsai@0606
        0x01,                   //bNumConfigurations: 1 configuration
};

//---- Configuration Descriptor ---- //cytsai@0312
#if (K_INTERFACE4)
//patch4.5@richie@audio interface begin
#if (K_AUDIOINTER)
#define K_CONFIGURATION_DESCRIPTOR_SIZE 0x0222
#else
#define K_CONFIGURATION_DESCRIPTOR_SIZE 0x00C5
#endif
//patch4.5@richie@audio interface end
#else
//patch4.5@richie@audio interface begin
#if (K_AUDIOINTER)
#define K_CONFIGURATION_DESCRIPTOR_SIZE 0x01D4 //0x0204
#else
#define K_CONFIGURATION_DESCRIPTOR_SIZE 0x00B7 //0x00B7
#endif
//patch4.5@richie@audio interface end
#endif
xdata    UINT8   K_ConfigurationDescriptor[] =
{
        //-------------------------------------------------------------------
        //TotalLength = 0x0222 byte
        //-------------------------------------------------------------------

        //-------------------------------------------------------------------
        //SubLength = 0x0009 byte 
        //-------------------------------------------------------------------

        //Configuration (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x02,                   //bDescriptorType: CONFIGURATION        

#if (K_INTERFACE4)
//patch4.5@richie@audio interface begin
#if (K_AUDIOINTER)
        0x22, 0x02,             //wTotalLength: 0x222 byte
        0x05,                   //bNumInterfaces: 5 interfaces
#else
        0xC5, 0x00,             //wTotalLength: 0xC5 byte
        0x03,                   //bNumInterfaces: 3 interfaces
#endif
//patch4.5@richie@audio interface end
#else
//patch4.5@richie@audio interface begin
#if (K_AUDIOINTER)
        0xD4, 0x01,             //wTotalLength: 0x204 byte
        0x04,                   //bNumInterfaces: 4 interfaces
#else
        0xB7, 0x00,             //wTotalLength: 0xA7 byte
        0x03,                   //bNumInterfaces: 2 interfaces
#endif
//patch4.5@richie@audio interface end
#endif
        0x01,                   //bConfigurationValue: configuration 1
        0x00,                   //iConfiguration: index of string
        0x80,                   //bmAttributes: bus powered
        0xFA,                   //MaxPower: 500 mA     



        //Interface 0, AlternateSetting 0 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x00,                   //bInterfaceNumber: interface 0
        0x00,                   //bAlternateSetting: alternate setting 0
        0x01,                   //bNumEndpoints: 1 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

        //Endpoint 4 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x87,                   //bEndpointAddress: IN endpoint 4
        0x03,                   //bmAttributes: Interrupt
        0x10, 0x00,             //wMaxPacketSize: 1 byte
        0x01,                   //bInterval: polling interval is 1 ms


        //-------------------------------------------------------------------
        //SubLength = 0x0080 byte 
        //-------------------------------------------------------------------

        //Interface 1, AlternateSetting 0 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x01,                   //bInterfaceNumber: interface 1
        0x00,                   //bAlternateSetting: alternate setting 0
        0x01,                   //bNumEndpoints: 1 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

        //Endpoint 1 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0x00, 0x00,             //wMaxPacketSize: 0 byte
        0x01,                   //bInterval: polling interval is 1 ms

        //Interface 1, AlternateSetting 1 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x01,                   //bInterfaceNumber: interface 1
        0x01,                   //bAlternateSetting: alternate setting 1
        0x01,                   //bNumEndpoints: 1 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

        //Endpoint 1 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0x80, 0x00,             //wMaxPacketSize: 128 byte
        0x01,                   //bInterval: polling interval is 1 ms

        //Interface 1, AlternateSetting 2 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x01,                   //bInterfaceNumber: interface 1
        0x02,                   //bAlternateSetting: alternate setting 2
        0x01,                   //bNumEndpoints: 1 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

        //Endpoint 1 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0x80, 0x01,             //wMaxPacketSize: 384 byte
        0x01,                   //bInterval: polling interval is 1 ms

        //Interface 1, AlternateSetting 3 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x01,                   //bInterfaceNumber: interface 1
        0x03,                   //bAlternateSetting: alternate setting 3
        0x01,                   //bNumEndpoints: 1 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

        //Endpoint 1 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0x00, 0x02,             //wMaxPacketSize: 512 byte
        0x01,                   //bInterval: polling interval is 1 ms

        //Interface 1, AlternateSetting 4 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x01,                   //bInterfaceNumber: interface 1
        0x04,                   //bAlternateSetting: alternate setting 4
        0x01,                   //bNumEndpoints: 1 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

        //Endpoint 1 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0x80, 0x02,             //wMaxPacketSize: 640 byte
        0x01,                   //bInterval: polling interval is 1 ms

#if 1 /* for WHQL */
        //Interface 1, AlternateSetting 5 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x01,                   //bInterfaceNumber: interface 1
        0x05,                   //bAlternateSetting: alternate setting 5
        0x01,                   //bNumEndpoints: 1 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

        //Endpoint 1 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0x00, 0x03,             //wMaxPacketSize: 768 byte
        0x01,                   //bInterval: polling interval is 1 ms

        //Interface 1, AlternateSetting 6 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x01,                   //bInterfaceNumber: interface 1
        0x06,                   //bAlternateSetting: alternate setting 6
        0x01,                   //bNumEndpoints: 1 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

        //Endpoint 1 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0x80, 0x03,             //wMaxPacketSize: 896 byte
        0x01,                   //bInterval: polling interval is 1 ms

        //Interface 1, AlternateSetting 7 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x01,                   //bInterfaceNumber: interface 1
        0x07,                   //bAlternateSetting: alternate setting 7
        0x01,                   //bNumEndpoints: 1 endpoint
        0xFF,                   //bInterfaceClass: vendor specific interface
        0x00,                   //bInterfaceSubClass: 0
        0x00,                   //bInterfaceProtocol: class specific protocol NOT used on this interface
        0x00,                   //iInterface: index of string

        //Endpoint 1 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x01,                   //bmAttributes: Isochronous
        0xff, 0x03,             //wMaxPacketSize: 1023 byte
        0x01,                   //bInterval: polling interval is 1 ms
#endif
        //-------------------------------------------------------------------
        //SubLength = 0x001e byte
        //-------------------------------------------------------------------

        //Interface 2 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x02,                   //bInterfaceNumber: interface 2
        0x00,                   //bAlternateSetting: alternate setting 0
        0x03,                   //bNumEndpoints: 3 endpoints
        0xFF,                   //bInterfaceClass: Vender Bulk
        0x00,                   //bInterfaceSubClass: UFI
	0x00,			// Bulk Only Rechie
        0x00,                   //iInterface: index of string

        //Endpoint 2 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x82,                   //bEndpointAddress: IN endpoint 2
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored

        //Endpoint 3 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x03,                   //bEndpointAddress: OUT endpoint 3
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored

        //Endpoint 4 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x84,                   //bEndpointAddress: IN endpoint 4
        0x03,                   //bmAttributes: Interrupt
        0x10, 0x00,             //wMaxPacketSize: 1 byte
        0x01,                   //bInterval: polling interval is 1 ms

        //-------------------------------------------------------------------
        //SubLength = 0x0027 byte ???? 
        //-------------------------------------------------------------------
//patch4.5@richie@audio interface begin
#if (K_AUDIOINTER)
//patch4.5@richie@audio interface end

        //Interface 2: Audio Control Interface Descriptor
        //Standard AC Interface Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x03,                   //bInterfaceNumber: interface 2
        0x00,                   //bAlternateSetting: alternate setting 0
        0x00,                   //bNumEndpoints: 0 endpoint
        0x01,                   //bInterfaceClass: AUDIO
        0x01,                   //bInterfaceSubClass: AUDIO_CONTROL
        0x00,                   //bInterfaceProtocol: 0
        0x00,                   //iInterface: index of string

        //Class-specific AC Interface Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x24,                   //bDescriptorType: CS_INTERFACE          
        0x01,                   //bDescriptorSubType: HEADER subtype        
        0x00, 0x01,             //bcdADC: revision of class specification - 1.00
        0x1e, 0x00,             //wTotalLength: 0x1e byte ????
        0x01,                   //bInCollection: 1 streaming interface
        0x03,                   //baInterfaceNr(1): AudioStreaming interface 3 belongs to the AudioControl interface

        //Input Terminal Descriptor (0x0c byte)
        0x0c,                   //bLength: 0x0c byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x02,                   //bDescriptorSubType: INPUT_TERMINAL subtype
        0x01,                   //bTerminalID: ID of this input terminal is 1
        0x01, 0x02,             //wTerminalType: Microphone
        0x04,                   //bAssocTerminal: ID of the associated output terminal is 4
        0x01,                   //bNrChannels: 1 channel
        0x00, 0x00,             //wChannelConfig: no position bits
        0x00,                   //iChannelNames: index of string
        0x00,                   //iTerminal: index of string


        //Output Terminal Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x03,                   //bDescriptorSubType: OUTPUT_TERMINAL subtype
        0x04,                   //bTerminalID: ID of this output terminal is 4
        0x01, 0x01,             //wTerminalType: USB streaming
        0x01,                   //bAssocTerminal: ID of the associated input terminal is 1
        0x01,                   //bSourceID: ID of source terminal is 1 (Microphone)
        0x00,                   //iTerminal: index of string

        //-------------------------------------------------------------------
        //SubLength = 0x0136 byte 
        //-------------------------------------------------------------------

        //Interface 3: Audio Streaming Interface Descriptor
        //Standard AS Interface Descriptor, AlternateSetting 0 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x04,                   //bInterfaceNumber: interface 3
        0x00,                   //bAlternateSetting: alternate setting 0
        0x00,                   //bNumEndpoints: 0 endpoint
        0x01,                   //bInterfaceClass: AUDIO
        0x02,                   //bInterfaceSubClass: AUDIO_STREAMING
        0x00,                   //bInterfaceProtocol: 0
        0x00,                   //iInterface: index of string

        //Standard AS Interface Descriptor, AlternateSetting 1 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x04,                   //bInterfaceNumber: interface 3
        0x01,                   //bAlternateSetting: alternate setting 1
        0x01,                   //bNumEndpoints: 1 endpoint
        0x01,                   //bInterfaceClass: AUDIO
        0x02,                   //bInterfaceSubClass: AUDIO_STREAMING
        0x00,                   //bInterfaceProtocol: 0
        0x00,                   //iInterface: index of string

        //Class-specific AS General Interface Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x04,                   //bTerminalLink: ID of output terminal is 4 (USB streaming)
        0x01,                   //bDelay: interface delay is 1 frame
        0x01, 0x00,             //wFormatTag: PCM format

        //Type I format Type Descriptor (0x0b byte)
        0x0b,                   //bLength: 0x0b byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x02,                   //bDescriptorSubType: FORMAT_TYPE subtype
        0x01,                   //bFormatType: FORMAT_TYPE_I
        0x01,                   //bNrChannels: 1 channel
        0x02,                   //bSubFrameSize: 2 byte per audio subframe
        0x10,                   //bBitResolution: 16 bits per sample
        0x01,                   //bSamFreqType: 1 frequency supported
        0x00, 0x00, 0x00,       //tSamFreq: 0 Hz

        //Standard AS Endpoint Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x86,                   //bEndpointAddress: IN endpoint 6
        0x01,                   //bmAttributes: Isochronous        
        0x10, 0x00,             //wMaxPacketSize: 16 byte
        0x01,                   //bInterval:  polling interval is 1 ms
        0x00,                   //bRefresh: 0 
        0x00,                   //bSyncAddress: 0

        //Class-specific AS Endpoint Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x25,                   //bDescriptorType: CS_ENDPOINT
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x00,                   //bmAttributes: no control is supported
        0x00,                   //bLockDelayUnits: 0
        0x00, 0x00,             //wLockDelay: 0

        //Standard AS Interface Descriptor, AlternateSetting 2 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x04,                   //bInterfaceNumber: interface 3
        0x02,                   //bAlternateSetting: alternate setting 2
        0x01,                   //bNumEndpoints: 1 endpoint
        0x01,                   //bInterfaceClass: AUDIO
        0x02,                   //bInterfaceSubClass: AUDIO_STREAMING
        0x00,                   //bInterfaceProtocol: 0
        0x00,                   //iInterface: index of string

        //Class-specific AS General Interface Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x04,                   //bTerminalLink: ID of output terminal is 4 (USB streaming)
        0x01,                   //bDelay: interface delay is 1 frame
        0x01, 0x00,             //wFormatTag: PCM format

        //Type I format Type Descriptor (0x0b byte)
        0x0b,                   //bLength: 0x0b byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x02,                   //bDescriptorSubType: FORMAT_TYPE subtype
        0x01,                   //bFormatType: FORMAT_TYPE_I
        0x01,                   //bNrChannels: 1 channel
        0x02,                   //bSubFrameSize: 2 byte per audio subframe
        0x10,                   //bBitResolution: 16 bits per sample
        0x01,                   //bSamFreqType: 1 frequency supported
        0x00, 0x00, 0x00,       //tSamFreq: 0 Hz

        //Standard AS Endpoint Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x86,                   //bEndpointAddress: IN endpoint 6
        0x01,                   //bmAttributes: Isochronous        
        0x20, 0x00,             //wMaxPacketSize: 32 byte
        0x01,                   //bInterval:  polling interval is 1 ms
        0x00,                   //bRefresh: 0 
        0x00,                   //bSyncAddress: 0

        //Class-specific AS Endpoint Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x25,                   //bDescriptorType: CS_ENDPOINT
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x00,                   //bmAttributes: no control is supported
        0x00,                   //bLockDelayUnits: 0
        0x00, 0x00,             //wLockDelay: 0

        //Standard AS Interface Descriptor, AlternateSetting 3 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x04,                   //bInterfaceNumber: interface 3
        0x03,                   //bAlternateSetting: alternate setting 3 
        0x01,                   //bNumEndpoints: 1 endpoint
        0x01,                   //bInterfaceClass: AUDIO
        0x02,                   //bInterfaceSubClass: AUDIO_STREAMING
        0x00,                   //bInterfaceProtocol: 0
        0x00,                   //iInterface: index of string

        //Class-specific AS General Interface Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x04,                   //bTerminalLink: ID of output terminal is 4 (USB streaming)
        0x01,                   //bDelay: interface delay is 1 frame
        0x01, 0x00,             //wFormatTag: PCM format

        //Type I format Type Descriptor (0x0b byte)
        0x0b,                   //bLength: 0x0b byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x02,                   //bDescriptorSubType: FORMAT_TYPE subtype
        0x01,                   //bFormatType: FORMAT_TYPE_I
        0x01,                   //bNrChannels: 1 channel
        0x02,                   //bSubFrameSize: 2 byte per audio subframe
        0x10,                   //bBitResolution: 16 bits per sample
        0x01,                   //bSamFreqType: 1 frequency supported
        0x00, 0x00, 0x00,       //tSamFreq: 0 Hz

        //Standard AS Endpoint Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x86,                   //bEndpointAddress: IN endpoint 6
        0x01,                   //bmAttributes: Isochronous        
        0x30, 0x00,             //wMaxPacketSize: 48 byte
        0x01,                   //bInterval:  polling interval is 1 ms
        0x00,                   //bRefresh: 0 
        0x00,                   //bSyncAddress: 0

        //Class-specific AS Endpoint Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x25,                   //bDescriptorType: CS_ENDPOINT
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x00,                   //bmAttributes: no control is supported
        0x00,                   //bLockDelayUnits: 0
        0x00, 0x00,             //wLockDelay: 0

        //Standard AS Interface Descriptor, AlternateSetting 4 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x04,                   //bInterfaceNumber: interface 3
        0x04,                   //bAlternateSetting: alternate setting 4
        0x01,                   //bNumEndpoints: 1 endpoint
        0x01,                   //bInterfaceClass: AUDIO
        0x02,                   //bInterfaceSubClass: AUDIO_STREAMING
        0x00,                   //bInterfaceProtocol: 0
        0x00,                   //iInterface: index of string

        //Class-specific AS General Interface Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x04,                   //bTerminalLink: ID of output terminal is 4 (USB streaming)
        0x01,                   //bDelay: interface delay is 1 frame
        0x01, 0x00,             //wFormatTag: PCM format

        //Type I format Type Descriptor (0x0b byte)
        0x0b,                   //bLength: 0x0b byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x02,                   //bDescriptorSubType: FORMAT_TYPE subtype
        0x01,                   //bFormatType: FORMAT_TYPE_I
        0x01,                   //bNrChannels: 1 channel
        0x02,                   //bSubFrameSize: 2 byte per audio subframe
        0x10,                   //bBitResolution: 16 bits per sample
        0x01,                   //bSamFreqType: 1 frequency supported
        0x00, 0x00, 0x00,       //tSamFreq: 0 Hz

        //Standard AS Endpoint Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x86,                   //bEndpointAddress: IN endpoint 6
        0x01,                   //bmAttributes: Isochronous        
        0x40, 0x00,             //wMaxPacketSize: 64 byte
        0x01,                   //bInterval:  polling interval is 1 ms
        0x00,                   //bRefresh: 0 
        0x00,                   //bSyncAddress: 0

        //Class-specific AS Endpoint Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x25,                   //bDescriptorType: CS_ENDPOINT
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x00,                   //bmAttributes: no control is supported
        0x00,                   //bLockDelayUnits: 0
        0x00, 0x00,             //wLockDelay: 0

        //Standard AS Interface Descriptor, AlternateSetting 5 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x04,                   //bInterfaceNumber: interface 3
        0x05,                   //bAlternateSetting: alternate setting 5
        0x01,                   //bNumEndpoints: 1 endpoint
        0x01,                   //bInterfaceClass: AUDIO
        0x02,                   //bInterfaceSubClass: AUDIO_STREAMING
        0x00,                   //bInterfaceProtocol: 0
        0x00,                   //iInterface: index of string

        //Class-specific AS General Interface Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x04,                   //bTerminalLink: ID of output terminal is 4 (USB streaming)
        0x01,                   //bDelay: interface delay is 1 frame
        0x01, 0x00,             //wFormatTag: PCM format

        //Type I format Type Descriptor (0x0b byte)
        0x0b,                   //bLength: 0x0b byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x02,                   //bDescriptorSubType: FORMAT_TYPE subtype
        0x01,                   //bFormatType: FORMAT_TYPE_I
        0x01,                   //bNrChannels: 1 channel
        0x02,                   //bSubFrameSize: 2 byte per audio subframe
        0x10,                   //bBitResolution: 16 bits per sample
        0x01,                   //bSamFreqType: 1 frequency supported
        0x00, 0x00, 0x00,       //tSamFreq: 0 Hz

        //Standard AS Endpoint Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x86,                   //bEndpointAddress: IN endpoint 6
        0x01,                   //bmAttributes: Isochronous        
        0x50, 0x00,             //wMaxPacketSize: 80 byte
        0x01,                   //bInterval:  polling interval is 1 ms
        0x00,                   //bRefresh: 0 
        0x00,                   //bSyncAddress: 0

        //Class-specific AS Endpoint Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x25,                   //bDescriptorType: CS_ENDPOINT
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x00,                   //bmAttributes: no control is supported
        0x00,                   //bLockDelayUnits: 0
        0x00, 0x00,             //wLockDelay: 0

        //Standard AS Interface Descriptor, AlternateSetting 6 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x04,                   //bInterfaceNumber: interface 3
        0x06,                   //bAlternateSetting: alternate setting 6
        0x01,                   //bNumEndpoints: 1 endpoint
        0x01,                   //bInterfaceClass: AUDIO
        0x02,                   //bInterfaceSubClass: AUDIO_STREAMING
        0x00,                   //bInterfaceProtocol: 0
        0x00,                   //iInterface: index of string

        //Class-specific AS General Interface Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x04,                   //bTerminalLink: ID of output terminal is 4 (USB streaming)
        0x01,                   //bDelay: interface delay is 1 frame
        0x01, 0x00,             //wFormatTag: PCM format

        //Type I format Type Descriptor (0x0b byte)
        0x0b,                   //bLength: 0x0b byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x02,                   //bDescriptorSubType: FORMAT_TYPE subtype
        0x01,                   //bFormatType: FORMAT_TYPE_I
        0x01,                   //bNrChannels: 1 channel
        0x02,                   //bSubFrameSize: 2 byte per audio subframe
        0x10,                   //bBitResolution: 16 bits per sample
        0x01,                   //bSamFreqType: 1 frequency supported
        0x00, 0x00, 0x00,       //tSamFreq: 0 Hz

        //Standard AS Endpoint Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x86,                   //bEndpointAddress: IN endpoint 6
        0x01,                   //bmAttributes: Isochronous        
        0x60, 0x00,             //wMaxPacketSize: 96 byte
        0x01,                   //bInterval:  polling interval is 1 ms
        0x00,                   //bRefresh: 0 
        0x00,                   //bSyncAddress: 0

        //Class-specific AS Endpoint Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x25,                   //bDescriptorType: CS_ENDPOINT
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x00,                   //bmAttributes: no control is supported
        0x00,                   //bLockDelayUnits: 0
        0x00, 0x00,             //wLockDelay: 0

        //Standard AS Interface Descriptor, AlternateSetting 7 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x04,                   //bInterfaceNumber: interface 3
        0x07,                   //bAlternateSetting: alternate setting 7
        0x01,                   //bNumEndpoints: 1 endpoint
        0x01,                   //bInterfaceClass: AUDIO
        0x02,                   //bInterfaceSubClass: AUDIO_STREAMING
        0x00,                   //bInterfaceProtocol: 0
        0x00,                   //iInterface: index of string

        //Class-specific AS General Interface Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x04,                   //bTerminalLink: ID of output terminal is 4 (USB streaming)
        0x01,                   //bDelay: interface delay is 1 frame
        0x01, 0x00,             //wFormatTag: PCM format

        //Type I format Type Descriptor (0x0b byte)
        0x0b,                   //bLength: 0x0b byte
        0x24,                   //bDescriptorType: CS_INTERFACE
        0x02,                   //bDescriptorSubType: FORMAT_TYPE subtype
        0x01,                   //bFormatType: FORMAT_TYPE_I
        0x01,                   //bNrChannels: 1 channel
        0x02,                   //bSubFrameSize: 2 byte per audio subframe
        0x10,                   //bBitResolution: 16 bits per sample
        0x01,                   //bSamFreqType: 1 frequency supported
        0x80, 0xbb, 0x00,       //tSamFreq: 48000 Hz

        //Standard AS Endpoint Descriptor (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x86,                   //bEndpointAddress: IN endpoint 6
        0x01,                   //bmAttributes: Isochronous        
        0x70, 0x00,             //wMaxPacketSize: 112 byte
        0x01,                   //bInterval:  polling interval is 1 ms
        0x00,                   //bRefresh: 0 
        0x00,                   //bSyncAddress: 0

        //Class-specific AS Endpoint Descriptor (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x25,                   //bDescriptorType: CS_ENDPOINT
        0x01,                   //bDescriptorSubType: GENERAL subtype
        0x00,                   //bmAttributes: no control is supported
        0x00,                   //bLockDelayUnits: 0
        0x00, 0x00,             //wLockDelay: 0


//patch4.5@richie@audio interface begin
#endif
//patch4.5@richie@audio interface end

//version4.0 richie@ps0503
#if (K_INTERFACE4)
	//richie@0124 add bulk 2
        //-------------------------------------------------------------------
        //SubLength = 0x001e byte
        //-------------------------------------------------------------------

        //Interface 4 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
//patch4.5@richie@audio interface begin
#if (K_AUDIOINTER)
        0x04,                   //bInterfaceNumber: interface 4
#else
        0x02,                   //bInterfaceNumber: interface 2
#endif
//patch4.5@richie@audio interface end
        0x00,                   //bAlternateSetting: alternate setting 0
        0x03,                   //bNumEndpoints: 3 endpoints
        0x08,                   //bInterfaceClass: Mass Storage Devices Class
        0x06,                   //bInterfaceSubClass: UFI
	0x50,			//Bulk Only
        0x00,                   //iInterface: index of string

        //Endpoint 2 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x87,                   //bEndpointAddress: IN endpoint 7
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored

        //Endpoint 3 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x08,                   //bEndpointAddress: OUT endpoint 8
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored

        //Endpoint 4 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x89,                   //bEndpointAddress: IN endpoint 9
        0x03,                   //bmAttributes: Interrupt
        0x01, 0x00,             //wMaxPacketSize: 1 byte
        0x01,                   //bInterval: polling interval is 1 ms
//version4.0 richie@ps0503
#endif
};

/////////////////////////////////////////////////////////////////////////////
//Descriptor Content of MSDC
//---- Device Descriptor ----
#define K_MSDC_DEVICE_DESCRIPTOR_SIZE        0x0012
xdata    UINT8   K_MSDC_DeviceDescriptor[] =
{
        //-------------------------------------------------------------------
        //TotalLength = 0x0012 byte
        //-------------------------------------------------------------------

        //Device (0x12 byte)
        0x12,                   //bLength: 0x12 byte
        0x01,                   //bDescriptorType: DEVICE
        0x00, 0x01,             //bcdUSB: version 1.00
        0x00,                   //bDeviceClass: independent interfaces
        0x00,                   //bDeviceSubClass: 0
        0x00,                   //bDeviceProtocol: class specific protocols NOT used on device basis
        0x40,                   //bMaxPacketSize0: maximum packet size for endpoint zero
        0xfc, 0x04,             //idVendor: vendor ID
        0x71, 0x01,             //idProduct: product ID (for MSDC)
        0x00, 0x01,             //bcdDevice: device release number in BCD
        0x01,                   //iManufacturer: index of string
        0x02,                   //iProduct: index of string 
        0x03,                   //iSerialNumber: index of string
        0x01,                   //bNumConfigurations: 1 configuration
};

//---- Configuration Descriptor of MSDC ----
#define K_MSDC_CONFIGURATION_DESCRIPTOR_SIZE 0x0027
xdata    UINT8   K_MSDC_ConfigurationDescriptor[] =
{
        //-------------------------------------------------------------------
        //SubLength = 0x0009 byte 
        //-------------------------------------------------------------------

        //Configuration (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x02,                   //bDescriptorType: CONFIGURATION        
        0x27, 0x00,             //wTotalLength:
        0x01,                   //bNumInterfaces: 1 interfaces
        0x01,                   //bConfigurationValue: configuration 1
        0x00,                   //iConfiguration: index of string
        0x80,                   //bmAttributes: bus powered
        0xFA,                   //MaxPower: 500 mA     

        //-------------------------------------------------------------------
        //SubLength = 0x001e byte
        //-------------------------------------------------------------------

        //Interface 1 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x00,                   //bInterfaceNumber: interface 0
        0x00,                   //bAlternateSetting: alternate setting 0
        0x03,                   //bNumEndpoints: 3 endpoints
        0x08,                   //bInterfaceClass: Mass Storage Devices Class
        0x06,                   //bInterfaceSubClass:
	0x50,		        //Bulk Only
        0x00,                   //iInterface: index of string

        //Endpoint 2 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x82,                   //bEndpointAddress: IN endpoint 7
        0x02,                   //bmAttributes: Bulk
        0x00, 0x02,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored

        //Endpoint 3 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x03,                   //bEndpointAddress: OUT endpoint 8
        0x02,                   //bmAttributes: Bulk
        0x00, 0x02,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored

        //Endpoint 4 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x84,                   //bEndpointAddress: IN endpoint 4
        0x03,                   //bmAttributes: Interrupt
        0x01, 0x00,             //wMaxPacketSize: 1 byte
        0x01,                   //bInterval: polling interval is 1 ms
};

//richie@si0401
/////////////////////////////////////////////////////////////////////////////
//Descriptor Content of SIDC
//---- Device Descriptor ----
#define K_SIDC_DEVICE_DESCRIPTOR_SIZE        0x0012
xdata    UINT8   K_SIDC_DeviceDescriptor[] =
{
        //-------------------------------------------------------------------
        //TotalLength = 0x0012 byte
        //-------------------------------------------------------------------

        //Device (0x12 byte)
        0x12,                   //bLength: 0x12 byte
        0x01,                   //bDescriptorType: DEVICE
        0x00, 0x01,             //bcdUSB: version 1.00
        0x00,                   //bDeviceClass: independent interfaces
        0x00,                   //bDeviceSubClass: 0
        0x00,                   //bDeviceProtocol: class specific protocols NOT used on device basis
        0x40,                   //bMaxPacketSize0: maximum packet size for endpoint zero
        0xfc, 0x04,             //idVendor: vendor ID
        0x72, 0x01,             //idProduct: product ID (for SIDC)
        0x00, 0x01,             //bcdDevice: device release number in BCD
        0x01,                   //iManufacturer: index of string
        0x02,                   //iProduct: index of string 
        0x03,                   //iSerialNumber: index of string
        0x01,                   //bNumConfigurations: 1 configuration
};

//---- Configuration Descriptor of SIDC ----
#define K_SIDC_CONFIGURATION_DESCRIPTOR_SIZE 0x0027
code    UINT8   K_SIDC_ConfigurationDescriptor[] =
{
        //-------------------------------------------------------------------
        //SubLength = 0x0009 byte 
        //-------------------------------------------------------------------

        //Configuration (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x02,                   //bDescriptorType: CONFIGURATION        
        0x27, 0x00,             //wTotalLength:
        0x01,                   //bNumInterfaces: 1 interfaces
        0x01,                   //bConfigurationValue: configuration 1
        0x00,                   //iConfiguration: index of string
        0x80,                   //bmAttributes: bus powered
        0xFA,                   //MaxPower: 500 mA     

        //-------------------------------------------------------------------
        //SubLength = 0x001e byte
        //-------------------------------------------------------------------

        //Interface 1 (0x09 byte)
        0x09,                   //bLength: 0x09 byte
        0x04,                   //bDescriptorType: INTERFACE
        0x00,                   //bInterfaceNumber: interface 1
        0x00,                   //bAlternateSetting: alternate setting 0
        0x03,                   //bNumEndpoints: 3 endpoints
        0x06,                   //bInterfaceClass: Still Image Devices Class
        0x01,                   //bInterfaceSubClass:
	0x01,			//Bulk Only
        0x00,                   //iInterface: index of string

        //Endpoint 2 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x82,                   //bEndpointAddress: IN endpoint 2
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored

        //Endpoint 3 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x03,                   //bEndpointAddress: OUT endpoint 8
        0x02,                   //bmAttributes: Bulk
        0x40, 0x00,             //wMaxPacketSize: 64 byte
        0x00,                   //bInterval: ignored

        //Endpoint 4 (0x07 byte)
        0x07,                   //bLength: 0x07 byte
        0x05,                   //bDescriptorType: ENDPOINT
        0x84,                   //bEndpointAddress: IN endpoint 9
        0x03,                   //bmAttributes: Interrupt
        0x40, 0x00,             //wMaxPacketSize: 1 byte
        0x01,                   //bInterval: polling interval is 1 ms
};


#define K_DEVICE_QUALIFIER_DESCRIPTOR_SIZE        0x000A
xdata    UINT8   K_DeviceQualifierDescriptor[] =
{
        //-------------------------------------------------------------------
        //TotalLength = 0x000A byte
        //-------------------------------------------------------------------

        //Device (0x0A byte)
        0x0A,                   //bLength: 0x0A byte
        0x06,                   //bDescriptorType: Device qualifier type
        0x00, 0x02,             //bcdUSB: version 2.00
        0x00,                   //bDeviceClass: independent interfaces
        0x00,                   //bDeviceSubClass: 0
        0x00,                   //bDeviceProtocol: class specific protocols NOT used on device basis
        0x40,                   //bMaxPacketSize0: maximum packet size for endpoint zero
        0x01,		            //bNumberConfigurations: 1
        0x00,	                //bReserved.
};
#endif /*__STDDESC_H__*/
